﻿function showThis(sender) {
    ul_inner = sender.innerHTML;
    ul_inner = ul_inner.substr(4, ul_inner.length - 9);

    var parts = ul_inner.split("</li><li>", 6);

    document.getElementById("info_from").innerHTML = "From: " + parts[0];
    document.getElementById("info_to").innerHTML = "To: " + parts[1];
    document.getElementById("info_status").innerHTML = parts[5];
    document.getElementById("info_created").innerHTML = "Created: " + parts[3];
    document.getElementById("info_sent").innerHTML = "Sent: " + parts[4];
    document.getElementById("messagecontent").innerHTML = "<p>" + parts[2] + "</p>";
}

function showThis_Inbox(sender) {
    ul_inner = sender.innerHTML;
    ul_inner = ul_inner.substr(4, ul_inner.length - 9);

    var parts = ul_inner.split("</li><li>", 6);

    document.getElementById("info_from").innerHTML = "From: " + parts[0];
    document.getElementById("info_service").innerHTML = "To: " + parts[1];
    document.getElementById("info_status").innerHTML = parts[5];
    document.getElementById("info_created").innerHTML = "Created: " + parts[3];
    document.getElementById("info_serviceid").innerHTML = "Service ID: " + parts[4];
    document.getElementById("messagecontent").innerHTML = "<p>" + parts[2] + "</p>";
}

function showThis_Trash(sender) {
    ul_inner = sender.innerHTML;
    ul_inner = ul_inner.substr(4, ul_inner.length - 9);

    var parts = ul_inner.split("</li><li>", 6);

    document.getElementById("info_from").innerHTML = "From: " + parts[0];
    document.getElementById("info_service").innerHTML = "To: " + parts[1];
    document.getElementById("info_serviceid").innerHTML = parts[5];
    document.getElementById("info_created").innerHTML = "Created: " + parts[3];
    document.getElementById("info_sent").innerHTML = "Sent: " + parts[4];
    document.getElementById("messagecontent").innerHTML = "<p>" + parts[2] + "</p>";
}

function testpage_function(url, target) {
    alert("hello: you're entering testpage_function");
    targetSpan = document.getElementById(target);

    if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp = new XMLHttpRequest();
    }
    else {// code for IE6, IE5
        //xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        alert("Sorry, but your browser's version is no longer supported");
        return;
    }
    xmlhttp.open("POST", url, true);
    xmlhttp.send(null);

    xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
            response = xmlhttp.responseXML;
            alert(response);
            //targetSpan.innerHTML = response;
        }

        /*if (xmlhttp.status == 200) {
            response = xmlhttp.responseXML;
            alert(response);
            
            if (response)
                targetSpan.innerHTML = response;
        }*/
    }
}
